package com.example.app.Entity;

import static androidx.room.ForeignKey.CASCADE;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.PrimaryKey;

@Entity(
    tableName = "likes",
    foreignKeys = {
        @ForeignKey(
            entity = User.class,
            parentColumns = "id",
            childColumns = "user_id",
            onDelete = CASCADE
        ),
        @ForeignKey(
            entity = Post.class,
            parentColumns = "id",
            childColumns = "post_id",
            onDelete = CASCADE
        )
    }
)
public class Like {
    @PrimaryKey(autoGenerate = true)
    private Long id;
    
    @ColumnInfo(name = "user_id")
    private Long userId;
    
    @ColumnInfo(name = "post_id")
    private Long postId;
    
    @ColumnInfo(name = "like_time")
    private Long likeTime; // 时间戳
    
    // Getters & Setters
}